<?php
/**
 * Created by PhpStorm.
 * User: Kiriti
 * Date: 2016/4/1 0001
 * Time: 14:57
 */

namespace app\controllers;

use yii\web\Controller;
use app\models\Rs_raised;
use app\models\Uc_user;
use app\models\Pr_support;
use Yii;
require_once('upload.php');

class HeaduploadController extends Controller{

    public $layout=false;
    public function actionShow(){


        if(!empty($_COOKIE['user_id'])){

            $user_id = $_COOKIE['user_id'];
            $user = Uc_user::find()
                ->where([
                    'user_id' => $user_id, //user_id => user_id
                    'del_flag' => 0
                ])
                ->one();
            $view = Yii::$app->view;
            $view->params['user_name'] = $user['user_name'];
            $view->params['field'] = $user['field'];
            $view->params['address'] = $user['address'];
            $view->params['title'] = "申请成为投资人";
            PrlikeController::setView($user);

            return $this->render('headupload.php');

        }else{
            echo "<script>alert('cookie 不存在')</script>";
            sleep(3);
            $this->redirect(['index/show']);
        }

	}
    public function actionUpload($path)
    {
        $user_id = $_COOKIE['user_id'];
        $user = Uc_user::find()->where([
            'user_id' => $user_id,
            'del_flag' => 0
        ])->one();
        $user['headImage'] = $path;
        $user->save();
    }


}